
<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

    <title>lavacli &#8212; LAVA 2024.05 documentation</title>
    <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
    <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/sphinx_highlight.js"></script>
    <link rel="shortcut icon" href="_static/favicon.ico"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Providing gold standard images" href="gold-standards.html" />
    <link rel="prev" title="Explaining the first job in detail" href="explain_first_job.html" />
    <link rel="canonical" href="https://docs.lavasoftware.org/lava/lavacli.html" />
  
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
<script type="text/javascript" src="_static/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.4.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>


  </head><body>

  <div id="navbar" class="navbar navbar-default navbar-fixed-top">
    <div class="container">
      <div class="navbar-header">
        <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="index.html"><span><img src="_static/lava.png"></span>
          LAVA</a>
        <span class="navbar-text navbar-version pull-left"><b>2024.05</b></span>
      </div>

        <div class="collapse navbar-collapse nav-collapse">
          <ul class="nav navbar-nav">
            
                <li><a href="genindex.html">Index</a></li>
                <li><a href="contents.html">Contents</a></li>
            
            
              <li class="dropdown globaltoc-container">
  <a role="button"
     id="dLabelGlobalToc"
     data-toggle="dropdown"
     data-target="#"
     href="index.html">Site <b class="caret"></b></a>
  <ul class="dropdown-menu globaltoc"
      role="menu"
      aria-labelledby="dLabelGlobalToc"><ul class="current">
<li class="toctree-l1"><a class="reference internal" href="index.html">Introduction to LAVA</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="contents.html">Contents</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary of terms</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="support.html">Getting support</a></li>
</ul>
</ul>
</li>
              
                <li class="dropdown">
  <a role="button"
     id="dLabelLocalToc"
     data-toggle="dropdown"
     data-target="#"
     href="#">Page <b class="caret"></b></a>
  <ul class="dropdown-menu localtoc"
      role="menu"
      aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">lavacli</a><ul>
<li><a class="reference internal" href="#installing-lavacli">Installing lavacli</a></li>
<li><a class="reference internal" href="#using-lavacli">Using lavacli</a></li>
</ul>
</li>
</ul>
</ul>
</li>
              
            
            
              
                
  <li>
    <a href="explain_first_job.html" title="Previous Chapter: Explaining the first job in detail"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; Explaining th...</span>
    </a>
  </li>
  <li>
    <a href="gold-standards.html" title="Next Chapter: Providing gold standard images"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Providing gol... &raquo;</span>
    </a>
  </li>
              
            
            
            
            
              <li class="hidden-sm"></li>
            
          </ul>

          
            
<form class="navbar-form navbar-right" action="search.html" method="get">
 <div class="form-group">
  <input type="text" name="q" class="form-control" placeholder="Search" />
 </div>
  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>
          
        </div>
    </div>
  </div>

<div class="container">
  <div class="row">
    <div class="body col-md-12 content" role="main">
      
  <section id="lavacli">
<span id="index-0"></span><span id="id1"></span><h1>lavacli<a class="headerlink" href="#lavacli" title="Permalink to this heading">¶</a></h1>
<p><code class="docutils literal notranslate"><span class="pre">lavacli</span></code> is the preferred command-line tool for interacting with the
various services offered by LAVA via XML-RPC APIs as well as using ZMQ.
The full list of XML-RPC API calls is visible on the <strong>Available
methods</strong> link from the API menu:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">localhost</span><span class="o">/</span><span class="n">api</span><span class="o">/</span><span class="n">help</span>
</pre></div>
</div>
<p>The API help page includes an example python script to connect to the local
instance. To add token support, use the syntax <strong>username:token</strong> for the
server concerned:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">xmlrpc.client</span>

<span class="n">server</span> <span class="o">=</span> <span class="n">xmlrpc</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">ServerProxy</span><span class="p">(</span><span class="s2">&quot;https://</span><span class="si">%s</span><span class="s2">:</span><span class="si">%s</span><span class="s2">@</span><span class="si">%s</span><span class="s2">/RPC2&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">username</span><span class="p">,</span> <span class="n">token</span><span class="p">,</span> <span class="n">server</span><span class="p">))</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">lavacli</span></code> is a native Python3 utility, the above example uses Python3
syntax.</p>
<p>See <a class="reference internal" href="data-export.html#xml-rpc"><span class="std std-ref">XML-RPC</span></a> for more information.</p>
<p>lavacli allows you to interact with all LAVA objects:</p>
<ul class="simple">
<li><p>aliases</p></li>
<li><p>device-types</p></li>
<li><p>devices</p></li>
<li><p>events</p></li>
<li><p>jobs</p></li>
<li><p>results</p></li>
<li><p>tags</p></li>
<li><p>workers</p></li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">lavacli</span></code> supports multiple <code class="docutils literal notranslate"><span class="pre">identities</span></code> to interact with multiple
instances of LAVA and as multiple users.</p>
<p><code class="docutils literal notranslate"><span class="pre">lavacli</span></code> can be used by users directly or in scripts. Scripts used
by build servers and continuous integration tools should ideally use a
dedicated user account. <code class="docutils literal notranslate"><span class="pre">lavacli</span></code> does not use prompts or other
interactive operations and secrets like tokens can be provided using a
configuration file (<code class="docutils literal notranslate"><span class="pre">~/.config/lavacli.yaml</span></code>) if the command line
option is not suitable.</p>
<section id="installing-lavacli">
<span id="id2"></span><h2>Installing lavacli<a class="headerlink" href="#installing-lavacli" title="Permalink to this heading">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">lavacli</span></code> can be installed alongside LAVA if the top level <code class="docutils literal notranslate"><span class="pre">lava</span></code>
package is installed on a <a class="reference internal" href="installing_on_debian.html#debian-installation"><span class="std std-ref">Debian-based distribution</span></a>. <code class="docutils literal notranslate"><span class="pre">lavacli</span></code> can also be installed on any remote
machine running a Debian-based distribution, without needing the rest
of LAVA. This allows a remote user to interact with any LAVA instance
on which the user has an account.:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sudo apt update
$ sudo apt install lavacli
</pre></div>
</div>
<p>(If you are installing on Debian Stretch, you will need to first enable
<code class="docutils literal notranslate"><span class="pre">backports</span></code> to install <code class="docutils literal notranslate"><span class="pre">lavacli</span></code>) and tell <code class="docutils literal notranslate"><span class="pre">apt</span></code> to use
<code class="docutils literal notranslate"><span class="pre">stretch-backports</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sudo apt -t stretch-backports install lavacli
</pre></div>
</div>
</section>
<section id="using-lavacli">
<span id="id3"></span><h2>Using lavacli<a class="headerlink" href="#using-lavacli" title="Permalink to this heading">¶</a></h2>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="first_steps.html#authentication-tokens"><span class="std std-ref">Creating &amp; displaying a token</span></a></p>
</div>
<p>Once the token is created, add it to the configuration of lavacli.
Click on the “Display the token” link on the “Authentication Tokens”
page and copy the token. e.g. if your token was created on
validation.linaro.org then you may want to use the identity
<code class="docutils literal notranslate"><span class="pre">production</span></code>. The <code class="docutils literal notranslate"><span class="pre">uri</span></code> is typically provided on the <em>Available
methods</em> page, e.g. <code class="docutils literal notranslate"><span class="pre">http://localhost/api/help</span></code>.</p>
<p>Run <code class="docutils literal notranslate"><span class="pre">lavacli</span></code> as your normal username. Avoid using <code class="docutils literal notranslate"><span class="pre">sudo</span></code>.</p>
<p>The syntax is:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">--</span><span class="n">uri</span> <span class="o">&lt;</span><span class="n">URI</span><span class="o">&gt;</span>
</pre></div>
</div>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ lavacli identities add --token &lt;TOKEN&gt; --uri https://validation.linaro.org/RPC2 --username &lt;USERNAME&gt; production
$ lavacli identities list
Identities:
* production

$ lavacli -i production jobs submit ../refactoring/standard/qemu-amd64-standard-stretch.yaml
1865811
</pre></div>
</div>
</section>
</section>


    </div>
      
  </div>
</div>
<footer class="footer">
  <div class="container">
    <p class="pull-right">
      <a href="#">Back to top</a>
      
    </p>
    <p>
        &copy; Copyright 2010-2019, Linaro Limited.<br/>
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 5.3.0.<br/>
    </p>
  </div>
</footer>
  </body>
</html>